package com.jxc.vo;

import lombok.Data;

@Data
public class Response<T>{

	private static final String SUCCESS = "SUCCESS";
	private static final String FAIL = "FAIL";
	
	private int code;
	
	private String message;

	private T result;

	public static <T>Response<T> getResult(T t) {
		Response<T> response = new Response<>();
		response.setResult(t);
		response.setMessage(SUCCESS);
		return response;
	}

	public static Response<Object> getSuccess() {
		Response<Object> response = new Response<>();
		response.setMessage(SUCCESS);
		return response;
	}

	public static Response<Object> getError(String msg) {
		Response<Object> response = new Response<>();
		response.setCode(-1);
		response.setMessage(msg);
		return response;		
	}
	
}
